<%@ page language="java" import="java.util.*, com.zjut.an.admin.dao.*, com.zjut.zs.coname.dao.*, com.zjut.zs.coname.manager.*, com.zjut.an.role.dao.*, com.zjut.an.role.manager.*, 
com.zjut.zs.exampage.dao.*,com.zjut.zs.exampage.manager.*, com.zjut.an.util.tools.*,
com.zjut.an.util.system.*,com.zjut.an.config.manager.*, com.zjut.an.config.dao.*,com.zjut.zs.util.tools.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" type="text/css" href="../plugins/layuiadmin/layui/css/layui.css" media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<%

AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
AnRoleManager rmanager = (AnRoleManager) SpringContextUtil.getBean("AnRoleManager");
ZsCoNameManager comanager = (ZsCoNameManager) SpringContextUtil.getBean("ZsCoNameManager");
ZsExamPageManager epmanager = (ZsExamPageManager) SpringContextUtil.getBean("ZsExamPageManager");
ZsHTMLCreat html = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
AnAdmin admin = (AnAdmin)session.getAttribute("admin");
AnRole role = rmanager.getData(admin.getRoId());

List columns = comanager.getDatasForExcel();
String en = "";
String cn = "";
for(int i=0; i<columns.size();i++){
	ZsCoName co = (ZsCoName)columns.get(i);
	en+=",'"+co.getCoEn()+"'";
	cn+=","+co.getCoEn()+":'"+co.getCoCn()+"'";
}
cn=cn.replaceFirst(",","");
en=en.replaceFirst(",","");
String url = "";
if(request.getParameter("appStatus")!=null) {
	url+="appStatus="+request.getParameter("appStatus")+"&";
}
if(request.getParameter("sendStatus")!=null) {
	url+="sendStatus="+request.getParameter("sendStatus")+"&";
}
if(request.getParameter("checkStatus")!=null) {
	url+="checkStatus="+request.getParameter("checkStatus")+"&";
}
if(request.getParameter("fileStatus")!=null) {
	url+="fileStatus="+request.getParameter("fileStatus")+"&";
}
if(request.getParameter("fileCheckStatus")!=null) {
	url+="fileCheckStatus="+request.getParameter("fileCheckStatus")+"&";
}
if(request.getParameter("passStatus")!=null) {
	url+="passStatus="+request.getParameter("passStatus")+"&";
}
if(request.getParameter("payStatus")!=null) {
	url+="payStatus="+request.getParameter("payStatus")+"&";
}
if(request.getParameter("localStatus")!=null) {
	url+="localStatus="+request.getParameter("localStatus")+"&";
}
if(request.getParameter("column1")!=null) {
	url+="column1="+request.getParameter("column1")+"&";
}
if(request.getParameter("column2")!=null) {
	url+="column2="+request.getParameter("column2")+"&";
}
if(request.getParameter("column3")!=null) {
	url+="column3="+request.getParameter("column3")+"&";
}
if(request.getParameter("column4")!=null) {
	url+="column4="+request.getParameter("column4")+"&";
}
if(request.getParameter("column5")!=null) {
	url+="column5="+request.getParameter("column5")+"&";
}
url+="step="+request.getParameter("step")+"&";
 %>
<body>
	<jsp:include page="systemrolevalidate.jsp" flush="true">
		<jsp:param name="m" value="userpower"/>
	</jsp:include>
	<blockquote class="layui-elem-quote news_search">
		<form action="" class="layui-form" id="searchform">
			<div class="layui-inline">
			    <div class="layui-input-inline" style="width: 100px;">
			    	<input value="" id="usName" name="usName" placeholder="姓名" class="layui-input search_input" type="text">
			    </div>
			</div>
			<div class="layui-inline">
			    <div class="layui-input-inline">
			    	<input value="" id="usIdcard" name="usIdcard" placeholder="身份证" class="layui-input search_input" type="text">
			    </div>
			</div>
			<div class="layui-inline">
			    <div class="layui-input-inline" style="width: 100px;">
			    	<input value="" id="usMobile" name="usMobile" placeholder="注册手机" class="layui-input search_input" type="text">
			    </div>
			</div>
			<div class="layui-inline" style="width: 100px;">
				<select name="fileStatus">
					<option value="">佐证材料状态</option>
			    	<option value="已上传">已上传</option>
			    	<option value="未上传">未上传</option>
			    	<option value="上传不完整">上传不完整</option>
			    </select>
			</div>
			<div class="layui-inline" style="width: 100px;">
				<select name="appStatus" id="appStatus">
					<option value="">材料确认</option>
					<option value="已确认">已确认</option>
					<option value="未确认">未确认</option>
				</select>
			</div>
			<div class="layui-inline" style="width: 100px;">
				<select name="fileCheckStatus" id="fileCheckStatus">
					<option value="">材料审核</option>
					<option value="合格">合格</option>
					<option value="不合格">不合格</option>
				</select>
			</div>
			<div class="layui-inline" style="width: 100px;">
				<select name="payStatus">
					<option value="">缴费状态</option>
			    	<option value="已缴费">已缴费</option>
			    	<option value="未缴费">未缴费</option>
			    </select>
			</div>
			<div class="layui-inline" style="width: 100px;">
			    <div class="layui-input-inline">
			    	<input value="" id="inZxName" name="inZxName" placeholder="中学" class="layui-input search_input" type="text">
			    </div>
			</div>
			<%if(!role.getRoName().contains("专业管理员")) { %>
			<div class="layui-inline" style="width: 100px;">
			    <div class="layui-input-inline">
			    	<input value="" id="column1" name="column1" placeholder="<%=comanager.getDataByCoEn("column1").getCoCn() %>" class="layui-input search_input" type="text">
			    </div>
			</div>
			<%} %>
			<div class="layui-inline" style="width: 100px;">
			    <div class="layui-input-inline">
			    	<input value="" id="scColumn2" name="scColumn2" placeholder="标签" class="layui-input search_input" type="text">
			    </div>
			</div>
			<div class="layui-inline">
			    <a class="layui-btn" lay-submit lay-filter="btnSearch">查询</a>
			</div>
		</form>
	</blockquote>
 
<table class="layui-hide" id="test" lay-filter="test"></table>

<script type="text/html" id="toolbarDemo">
  <div class="layui-btn-container">

<%if(request.getParameter("step")!=null && (Status.STEP_1.getStatus().equals(request.getParameter("step")) || Status.STEP_2.getStatus().equals(request.getParameter("step")) )) {%>
    <button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="thcg">退回重改</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="bztj">帮助提交</button>
    <button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="thbccl">退回补充材料</button>
    <button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="yqbccl">延期补充材料</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="qrcl">确认材料</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="clhg">材料合格</button>
    <button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="clbhg">材料不合格</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="cstg">初审通过</button>
    <button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="csbg">初审不过</button>
    <button class="layui-btn layui-btn-xs" lay-event="qxcs">取消初审</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="emsqs">EMS签收</button>
    <button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="emswqs">EMS未签收</button>
<%}%>
<%if(request.getParameter("step")!=null && Status.STEP_3.getStatus().equals(request.getParameter("step"))) {%>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="zkzbh">准考证编号</button>
    <button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="qkbh">清空编号</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="szzkz">设置准考证</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="pldyzkz">批量打印准考证</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="yjf">已缴费</button>
    <button class="layui-btn layui-btn-xs layui-btn-warm" lay-event="wjf">未缴费</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="kstg">考试通过</button>
    <button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="ksbg">考试不过</button>
    <button class="layui-btn layui-btn-xs" lay-event="qxkszt">取消考试状态</button>
<%}%>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="szbq">设置标签</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="pldy">批量打印</button>
    <button class="layui-btn layui-btn-xs layui-btn-green" lay-event="dqsxexcel">所选导出excel</button>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="dqdcexcel">当前导出excel</button>
<%if("1".equals(html.getJsonValue("sms"))) { %>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="fsdx">发送短信</button>
<%}%>
    <button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="llms">浏览模式</button>
  </div>
</script>
 
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="detail">编辑</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="print">申请表</a>
</script>

<script type="text/javascript" src="../plugins/layuiadmin/layui/layui.js"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 --> 
<script type="text/javascript" src="../plugins/layuiadmin/layui/layui_exts/excel.js"></script>
<script>
var $;
layui.use(['jquery'], function(){ 
   $ = layui.$;
});
var table;
layui.use(['table','form'], function(){
  table = layui.table
  ,form = layui.form;
  
  table.render({
    elem: '#test'
    ,url:'../zsApplyViewList.action?<%=url%>'
    ,where: {time:new Date().getTime()}
    ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
    ,toolbar: '#toolbarDemo'
    ,title: '数据'
    ,cols: [[
      {type: 'checkbox', fixed: 'left'}
      ,{field:'usId', title:'ID', width:80, fixed: 'left', unresize: true, sort: true}
      ,{field:'usNo', title:'序号', width:80, fixed: 'left', sort: true}
      ,{field:'usName', title:'姓名', width:80, sort: true}
      ,{field:'usIdcard', title:'身份证', width:160, sort: true}
      ,{field:'usMobile', title:'电话', width:120, sort: true}
      ,{field:'fileStatus', title:'佐证材料', width:100, sort: true} 
      ,{field:'appStatus', title:'材料确认', width:100, sort: true} 
      ,{field:'fileCheckStatus', title:'材料审核', width:100, sort: true} 
      ,{field:'sendStatus', title:'提交状态', width:100, sort: true} 
      ,{field:'sendTime', title:'提交时间', width:120, sort: true,hide:true} 
      ,{field:'checkStatus', title:'初审状态', width:100, sort: true} 
      ,{field:'payStatus', title:'缴费状态', width:100, sort: true} 
      ,{field:'scColumn2', title:'标签', width:120, sort: true} 
      ,{field:'usEmail', title:'邮箱', width:80, sort: true,hide:true} 
      ,{field:'inSex', title:'性别', width:80, sort: true,hide:true} 
      ,{field:'inBirthday', title:'出生年月', width:80, sort: true,hide:true} 
      ,{field:'inMz', title:'民族', width:80, sort: true,hide:true} 
      ,{field:'inZz', title:'政治面貌', width:80, sort: true,hide:true} 
      ,{field:'inBkType', title:'考生类型', width:80, sort: true,hide:true} 
      ,{field:'inTxdzSf', title:'联系省份  ', width:80, sort: true,hide:true} 
      ,{field:'inTxdzCs', title:'联系市', width:80, sort: true,hide:true} 
      ,{field:'inTxdzDq', title:'联系县', width:80, sort: true,hide:true} 
      ,{field:'inTxdzXxdz', title:'具体地址', width:80, sort: true,hide:true} 
      ,{field:'inZxName', title:'毕业中学', width:80, sort: true,hide:true} 
      ,{field:'xyYw', title:'语文', width:80, sort: true,hide:true} 
      ,{field:'xySx', title:'数学', width:80, sort: true,hide:true} 
      ,{field:'xyZz', title:'政治', width:80, sort: true,hide:true} 
      ,{field:'xyLs', title:'历史', width:80, sort: true,hide:true} 
      ,{field:'xyDl', title:'地理', width:80, sort: true,hide:true} 
      ,{field:'xyWl', title:'物理', width:80, sort: true,hide:true} 
      ,{field:'xyHx', title:'化学', width:80, sort: true,hide:true} 
      ,{field:'xySw', title:'生物', width:80, sort: true,hide:true} 
      ,{field:'xyJs', title:'技术', width:80, sort: true,hide:true} 
      ,{field:'xyTyjs', title:'通用技术', width:80, sort: true,hide:true} 
      ,{field:'xyZxzh1', title:'品德表现', width:80, sort: true,hide:true} 
      ,{field:'xyZxzh2', title:'运动健康', width:80, sort: true,hide:true} 
      ,{field:'xyZxzh3', title:'艺术素养', width:80, sort: true,hide:true} 
      ,{field:'xyZxzh4', title:'创新实践', width:80, sort: true,hide:true} 
	  <%if(request.getParameter("step")!=null && Status.STEP_3.getStatus().equals(request.getParameter("step"))) {%>
      ,{field:'localStatus', title:'签到状态', width:80, sort: true} 
      ,{field:'exId', title:'准考证', width:120, sort: true} 
      ,{field:'testNo', title:'准考证号', width:120, sort: true}
      ,{field:'passStatus', title:'考试状态', width:80, sort: true} 
      ,{field:'testNum', title:'综合测试成绩', width:120, sort: true} 
	  <%} %> 
	  ,{field:'column1', title:'<%=comanager.getDataByCoEn("column1").getCoCn() %>', width:120, sort: true} 
      ,{field:'column2', title:'<%=comanager.getDataByCoEn("column2").getCoCn() %>', width:120, sort: true} 
      ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
    ]]
    ,response: {
      statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
    }
    ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
    	//console.log(JSON.stringify(res.rows))
    	this.limits=getLimits(res.total);
      return {
        "code": 200, //解析接口状态
        "msg": res.message, //解析提示文本
        "count": res.total, //解析数据长度
        "data": res.rows //解析数据列表
      };
    }
    ,page: true
    ,id:"table1"
  });
  //监听排序事件 
  table.on('sort(test)', function(obj) { //注：sort 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"。
	table.reload('table1', {
		initSort : obj, //记录初始排序
		where : { //请求参数
			sort : obj.field, //排序字段
			order : obj.type  //排序方式
		}
	});
  });
  //监听单元格编辑
  table.on('edit(test)', function(obj){
    var value = obj.value //得到修改后的值
    ,data = obj.data //得到所在行所有键值
    ,field = obj.field; //得到字段
    console.info(data);
    $.ajax({
		type:"post",
		url:"../zsApplyViewUpdate.action",
		data:{
			rowstr:JSON.stringify(data)
		},
		async:true,
		cache:false,
		success:function(res){
			layer.msg('提交成功');
		}
	 });
    layer.msg('[ID: '+ data.coId +'] ' + field + ' 字段更改为：'+ value);
  });
  //头工具栏事件
  table.on('toolbar(test)', function(obj){
    var checkStatus = table.checkStatus(obj.config.id);
    //console.log(checkStatus.data)
    switch(obj.event){
      case 'thcg':
    	  checkSelections(checkStatus, '../zsUserStatusSend.action?sendStatus=<%=Status.SENDSTATUS_NO.getStatus()%>')
      break;
      case 'bztj':
    	  checkSelections(checkStatus, '../zsUserStatusSend.action?sendStatus=<%=Status.SENDSTATUS_YES.getStatus()%>')
      break;
      case 'thbccl':
    	  checkSelections(checkStatus, '../zsUserStatusApp.action?appStatus=<%=Status.APPSTATUS_NULL.getStatus()%>')
      break;
      case 'yqbccl':
    	  checkSelections(checkStatus, '../zsUserStatusApp.action?appStatus=<%=Status.APPSTATUS_NO.getStatus()%>')
      break;
      case 'qrcl':
    	  checkSelections(checkStatus, '../zsUserStatusApp.action?appStatus=<%=Status.APPSTATUS_YES.getStatus()%>')
      break;
      case 'clhg':
    	  checkSelections(checkStatus, '../zsUserStatusFileCheck.action?fileCheckStatus=<%=Status.OK.getStatus()%>')
      break;
      case 'clbhg':
    	  checkSelections(checkStatus, '../zsUserStatusFileCheck.action?fileCheckStatus=<%=Status.ERROR.getStatus()%>')
      break;
      case 'cstg':
    	  checkSelections(checkStatus, '../zsUserStatusCheck.action?checkStatus=<%=Status.CHECKSTATUS_YES.getStatus()%>')
      break;
      case 'csbg':
    	  checkSelections(checkStatus, '../zsUserStatusCheck.action?checkStatus=<%=Status.CHECKSTATUS_NO.getStatus()%>')
      break;
      case 'qxcs':
    	  checkSelections(checkStatus, '../zsUserStatusCheck.action?checkStatus=<%=Status.CHECKSTATUS_NULL.getStatus()%>')
      break;
      case 'thcg':
    	  checkSelections(checkStatus, '../zsUserStatusSend.action?sendStatus=<%=Status.SENDSTATUS_NO.getStatus()%>')
      break;
      case 'emsqs':
    	  checkSelections(checkStatus, '../zsUserStatusEms.action?emsStatus=<%=Status.EMSSTATUS_YES.getStatus()%>')
      break;
      case 'emswqs':
    	  checkSelections(checkStatus, '../zsUserStatusEms.action?emsStatus=<%=Status.EMSSTATUS_NULL.getStatus()%>')
      break;
      case 'zkzbh':
    	  setNo(checkStatus);
      break;          
      case 'qkbh':
    	  checkSelections(checkStatus, '../zsApplyViewSetTestNo.action?testnotype=clear')
      break;
      case 'szzkz':
    	  setZkz(checkStatus);
      break;
      case 'pldyzkz':
    	  printAllExam(checkStatus);
      break;
      case 'yjf':
    	  checkSelections(checkStatus, '../zsUserStatusPay.action?payStatus=<%=Status.PAYSTATUS_YES.getStatus()%>')
      break;
      case 'wjf':
    	  checkSelections(checkStatus, '../zsUserStatusPay.action?payStatus=<%=Status.PAYSTATUS_NULL.getStatus()%>')
      break;
      case 'kstg':
    	  checkSelections(checkStatus, '../zsUserStatusPass.action?passStatus=<%=Status.PASSSTATUS_YES.getStatus()%>')
      break;
      case 'ksbg':
    	  checkSelections(checkStatus, '../zsUserStatusPass.action?passStatus=<%=Status.PASSSTATUS_NO.getStatus()%>')
      break;
      case 'qxkszt':
    	  checkSelections(checkStatus, '../zsUserStatusPass.action?passStatus=<%=Status.PASSSTATUS_NULL.getStatus()%>')
      break;
      case 'pldy':
    	  printAll(checkStatus)
      break;
      case 'dqdcexcel':
    	  exportToExcel(checkStatus);
      break;
      case 'dqsxexcel':
    	  exportToExcelBySelect(checkStatus);
      break;
      case 'szbq':
    	  setTag(checkStatus);
      break;
      case 'fsdx':
    	  sendSms(checkStatus);
      break;
      case 'llms':
    	  top.layui.index.openTabsPage('zsApplyViewListCheck.jsp?<%=url%>');
      break;
      
      case 'add':
		layer.open({
			type: 2,
			title: "新增配置",
			area: ['40%', '60%'],
			fix: false,
			maxmin: true,
			shadeClose: true,
			shade: 0.4,
			skin: 'layui-layer-rim',
			content:["zsApplyViewAdd.jsp?<%=url%>", "yes"],
		});
	  break;
    };
  });
  //监听工具条
  table.on('tool(test)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
    var data = obj.data; //获得当前行数据
    var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
    var tr = obj.tr; //获得当前行 tr 的DOM对象
    if(layEvent === 'detail'){ //查看
    	top.layui.index.openTabsPage('zsApplyViewEdit.jsp?usId='+data.usId, data.usName);
    } else if(layEvent === 'print'){ //打印
    	top.layui.index.openTabsPage('../apply/zs_appprint.jsp?usId='+data.usId, data.usName);
    } else if(layEvent === 'edit'){ //编辑
    	layer.msg('直接点击内容进行修改')
  	}
  });
  //监听提交
  form.on('submit(btnSearch)', function(data){
    var rowData = data.field;
    console.info(rowData);
		table.reload('table1', {
		  url:'../zsApplyViewList.action?<%=url %>'
		  ,where: {
		  	"usName":rowData.usName,
		  	"usIdcard":rowData.usIdcard,
		  	"usMobile":rowData.usMobile,
		  	"fileStatus":rowData.fileStatus,
		  	"fileCheckStatus":rowData.fileCheckStatus,
		  	"appStatus":rowData.appStatus,
		  	"inZxName":rowData.inZxName,
		  	"column1":rowData.column1,
		  	"scColumn2":rowData.scColumn2,
		  	"payStatus":rowData.payStatus
		  } //设定异步数据接口的额外参数
		  //,height: 300
		});
    return false;
  });
});

function checkSelections(checkStatus, actionurl){//批量操作通用方法
      layui.use('layer', function(){
      var layer = layui.layer;
      layer.confirm('确定操作选中行？', function(index){
		//layer.close(index);
	    $.ajax({
	    	type:"post",
	    	url:actionurl,
	    	data:{
	    		rowstr:JSON.stringify(checkStatus.data)
	    	},
	    	cache:false,
	    	async:true,
	    	success:function(res){
	    		if(res.flag === 'success'){
	    			layer.msg('操作成功');
	    			table.reload('table1', {where: {time:new Date().getTime()}});
	    		}else{
	    			layer.msg('操作失败')
	    		}
	    	}
	    });
	    //向服务端发送操作指令
	  });
    });
}

function sendSms(checkStatus){
	layui.use('layer', function(){
      	var layer = layui.layer;
      	layer.prompt(function(val, index){
		  	layer.msg('短信内容：'+val);
		    layer.confirm('确定操作选中行？', function(index){
				//layer.close(index);
			    $.ajax({
			    	type:"post",
			    	url:'../zsApplyViewSmsBySelect.action?message='+val,
			    	data:{
			    		rowstr:JSON.stringify(checkStatus.data)
			    	},
			    	cache:false,
			    	async:true,
			    	success:function(res){
			    		if(res.flag === 'success'){
			    			layer.msg('操作成功');
			    			table.reload('table1', {where: {time:new Date().getTime()}});
			    		}else{
			    			layer.msg('操作失败')
			    		}
			    	}
			    });
			    //向服务端发送操作指令
			  });		  
		  	layer.close(index);
		});
    });  	
}

function setNo(checkStatus){
	layui.use('layer', function(){
      	var layer = layui.layer;
      	layer.prompt({title: '输入准考证起始编号，请勿与现有编号重号', formType: 0}, function(val, index){
		  	layer.msg('准考证起始编号：'+val);
		    layer.confirm('确定操作选中行？', function(index){
				//layer.close(index);
			    $.ajax({
			    	type:"post",
			    	url:'../zsApplyViewSetTestNo.action?begin='+val+'&testnotype=auto',
			    	data:{
			    		rowstr:JSON.stringify(checkStatus.data)
			    	},
			    	cache:false,
			    	async:true,
			    	success:function(res){
			    		if(res.flag === 'success'){
			    			layer.msg('操作成功');
			    			table.reload('table1', {where: {time:new Date().getTime()}});
			    		}else{
			    			layer.msg('操作失败')
			    		}
			    	}
			    });
			    //向服务端发送操作指令
			  });		  
		  	layer.close(index);
		});
    });  	
}		

function setTag(checkStatus){
	<%
	String tags = "<select name=\"tag\" id=\"tag\"  lay-verify=\"\">";
	AnConfig tagconfig = new AnConfig();
	tagconfig.setCoClass("标签配置");
	List tlist = anconfig.getDataByInstance(1,100,null,null,tagconfig).getObjects();
	for (int i=0; i<tlist.size(); i++){
		tagconfig = (AnConfig)tlist.get(i);
		tags +="<option value=\""+tagconfig.getCoValue()+"\">"+tagconfig.getCoValue()+"</option>"; 
	} 
	tags+="</select>";	
	%>
	layui.use('layer', function(){
      	var layer = layui.layer;
      	layer.prompt({
		formType: 2,//这里依然指定类型是多行文本框，但是在下面content中也可绑定多行文本框
		title: '选择标签',
		area: ['300px', '200px'],
		btnAlign: 'c',
		content: '<div><p>准考证:</p><%=tags%></div>',
		yes: function (index, layero) {
			$.ajax({
		    	type:"post",
		    	url:'../zsUserStatusTag.action?tag='+ $('#tag').val(),
		    	data:{
		    		rowstr:JSON.stringify(checkStatus.data)
		    	},
		    	cache:false,
		    	async:true,
		    	success:function(res){
		    		if(res.flag === 'success'){
		    			layer.msg('操作成功');
		    			table.reload('table1', {where: {time:new Date().getTime()}});
		    		}else{
		    			layer.msg('操作失败')
		    		}
		    	}
		    });
			//向服务端发送操作指令
			layer.close(index);
		    }		
		});  
    });  	
}	

function setZkz(checkStatus){
	<%
	String zkz = "<select name=\"exid\" id=\"exid\"  lay-verify=\"\">";
	ZsExamPage expage = new ZsExamPage();
	expage.setExType("准考证");
	List list = epmanager.getDataByInstance(1,100,null,null,expage).getObjects();
	for (int i=0; i<list.size(); i++){
		expage = (ZsExamPage)list.get(i);
		zkz +="<option value=\""+expage.getExId()+"\">"+expage.getExTitle()+"</option>"; 
	} 
	zkz+="</select>";	
	%>
	layui.use('layer', function(){
      	var layer = layui.layer;
      	layer.prompt({
		formType: 2,//这里依然指定类型是多行文本框，但是在下面content中也可绑定多行文本框
		title: '选择准考证模板',
		area: ['300px', '200px'],
		btnAlign: 'c',
		content: '<div><p>准考证:</p><%=zkz%></div>',
		yes: function (index, layero) {
			$.ajax({
		    	type:"post",
		    	url:'../zsUserStatusExId.action?exId='+ $('#exid').val(),
		    	data:{
		    		rowstr:JSON.stringify(checkStatus.data)
		    	},
		    	cache:false,
		    	async:true,
		    	success:function(res){
		    		if(res.flag === 'success'){
		    			layer.msg('操作成功');
		    			table.reload('table1', {where: {time:new Date().getTime()}});
		    		}else{
		    			layer.msg('操作失败')
		    		}
		    	}
		    });
			//向服务端发送操作指令
			layer.close(index);
		    }		
		});  
    });  	
}	
	
function printAll(checkStatus){
	  layui.use('layer', function(){
      var layer = layui.layer;
      layer.confirm('确定操作选中行？', function(index){
		var rowstr = JSON.stringify(checkStatus.data);
		var form=$("<form>");
		form.attr("style","display:none");
		form.attr("target","_blank");
		form.attr("method","post");
		form.attr("action","zsApplyViewPrintAll.jsp");
		var input1=$("<input>");
		input1.attr("type","hidden");
		input1.attr("name","rowstr");
		input1.attr("value",rowstr);
		$("body").append(form);
		form.append(input1);
		form.submit();
	    //向服务端发送操作指令
	    layer.close(index);
	  });
    });
}

function printAllExam(checkStatus){
	layui.use('layer', function(){
    	var layer = layui.layer;
    	layer.confirm('确定操作选中行？', function(index){
    		var rowstr = JSON.stringify(checkStatus.data);
			var form=$("<form>");
			form.attr("style","display:none");
			form.attr("target","_blank");
			form.attr("method","post");
			form.attr("action","zsApplyExamPrintAll.jsp");
			var input1=$("<input>");
			input1.attr("type","hidden");
			input1.attr("name","rowstr");
			input1.attr("value",rowstr);
			$("body").append(form);
			form.append(input1);
			form.submit();
	    	layer.close(index);
    	});
    });
}

//https://blog.csdn.net/zhi258wei/article/details/91411596	
function exportToExcel(checkStatus){
	layui.config({//配置并导入excel插件
		base: '../plugins/layuiadmin/layui/layui_exts/'
	}).use([ 'excel', 'layer'], function() {
	var $ = layui.$;
	var layer = layui.layer;
	var excel = layui.excel;
		// 模拟从后端接口读取需要导出的数据
		$.ajax({
			url: '../zsApplyViewExportExcel.action?<%=url%>'
			,dataType: 'json'
			,success(res) {
				var data = res.rows;
				console.log(data);
				// 如果后端给的数据顺序和映射关系不对，请执行梳理函数后导出
				data = excel.filterExportData(data, [<%=en%>]);
				// 一般都需要加一个表头，表头的键名顺序需要与最终导出的数据一致
				data.unshift({<%=cn%>});
				parent.layui.excel.exportExcel({sheet1: data}, '导出数据.xlsx', 'xlsx');
			}
			,error() {
				layer.alert('获取数据失败，请检查是否部署在本地服务器环境下');
			}
		});
	});
}

//https://blog.csdn.net/zhi258wei/article/details/91411596	
function exportToExcelBySelect(checkStatus){
	layui.config({//配置并导入excel插件
		base: '../plugins/layuiadmin/layui/layui_exts/'
	}).use([ 'excel', 'layer'], function() {
	var $ = layui.$;
	var layer = layui.layer;
	var excel = layui.excel;
		// 模拟从后端接口读取需要导出的数据
		console.info(JSON.stringify(checkStatus.data));
		$.ajax({
			type:"post",
			url: '../zsApplyViewExportExcelBySelect.action?<%=url%>',
			data:{
	    		rowstr:JSON.stringify(checkStatus.data)
	    	},
	    	cache:false,
	    	async:true,
			dataType: 'json',
			success(res) {
				var data = res.rows;
				console.log(data);
				// 如果后端给的数据顺序和映射关系不对，请执行梳理函数后导出
				data = excel.filterExportData(data, [<%=en%>]);
				// 一般都需要加一个表头，表头的键名顺序需要与最终导出的数据一致
				data.unshift({<%=cn%>});
				parent.layui.excel.exportExcel({sheet1: data}, '导出数据.xlsx', 'xlsx');
			},
			error() {
				layer.alert('获取数据失败，请检查是否部署在本地服务器环境下');
			}
		});
	});
}
function getLimits(total){
	var arr=[10],i=0;
	addLimit();
	function addLimit(){
		if(total>arr[i]){
			var d = arr[i]*2;
			if(total>d && d<1000){
				arr.push(d);
				i++;
				addLimit();
			}else{
				arr.push(total);
			}
		}
	}
	return arr;
}
</script>

</body>
</html>